﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace HotelManagement.Common
{
    public class Trade
    {
        #region Constant
        private readonly string COL_ID = "ID";
        private readonly string COL_TYPE = "Type";
        private readonly string COL_GOODS_ID = "Goods_ID";
        private readonly string COL_GOODS_NAME = "Goods_Name";
        private readonly string COL_COUNT = "Count";
        private readonly string COL_COST = "Cost";
        private readonly string COL_DATE = "Date";
        #endregion

        #region Properties
        private int m_nID;
        public int ID
        {
            get { return m_nID; }
            set { m_nID = value; }
        }

        private string m_strType;
        public string Type
        {
            get { return m_strType; }
            set { m_strType = value; }
        }

        private int m_nGoodsID;
        public int GoodsID
        {
            get { return m_nGoodsID; }
            set { m_nGoodsID = value; }
        }

        private string m_strGoodsName;
        public string GoodsName
        {
            get { return m_strGoodsName; }
            set { m_strGoodsName = value; }
        }

        private int m_nCount;
        public int Count
        {
            get { return m_nCount; }
            set { m_nCount = value; }
        }

        private float m_nCost;
        public float Cost
        {
            get { return m_nCost; }
            set { m_nCost = value; }
        }

        private DateTime m_nTradeTime;
        public DateTime TradeTime
        {
            get { return m_nTradeTime; }
            set { m_nTradeTime = value; }
        }

        private string m_strTradeTimeStart;
        public string TradeTimeStart
        {
            get { return m_strTradeTimeStart; }
            set { m_strTradeTimeStart = value; }
        }

        private string m_strTradeTimeEnd;
        public string TradeTimeEnd
        {
            get { return m_strTradeTimeEnd; }
            set { m_strTradeTimeEnd = value; }
        }

        private DataTable m_datTradeCollection;
        public DataTable TradeCollection
        {
            get 
            {
                if (m_datTradeCollection == null || m_datTradeCollection.Columns.Count == 0)
                {
                    InitTradeCollection();
                }
                return m_datTradeCollection; 
            }
            set 
            { 
                m_datTradeCollection = value; 
            }
        }
        #endregion

        #region Public Method
        public void ClearTradeCollection()
        {
            m_datTradeCollection.Clear();
            m_datTradeCollection.Dispose();
        }
        #endregion

        #region Private Method
        private void InitTradeCollection()
        {
            m_datTradeCollection = new DataTable();
            m_datTradeCollection.Columns.Add(COL_ID, typeof(string));
            m_datTradeCollection.Columns.Add(COL_TYPE, typeof(string));
            m_datTradeCollection.Columns.Add(COL_GOODS_ID, typeof(string));
            m_datTradeCollection.Columns.Add(COL_GOODS_NAME, typeof(string));
            m_datTradeCollection.Columns.Add(COL_COUNT, typeof(int));
            m_datTradeCollection.Columns.Add(COL_COST, typeof(float));
            m_datTradeCollection.Columns.Add(COL_DATE, typeof(DateTime));
        }
        #endregion
    }
}
